home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14444 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  42 lines

  1. Path: news.ichange.com!newsmaster
  2. From: Jesse Liberty <jl@staff.ichange.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Derivation and calling virtual functions
  5. Date: Sat, 30 Mar 1996 13:18:08 -0500
  6. Organization: AT&T New Media Services
  7. Message-ID: <315D7AE0.2BFF@staff.ichange.com>
  8. References: <graphix.828032689@spiff.cc.iastate.edu> <4jeulg$n9v@crc-news.doc.ca>
  9. NNTP-Posting-Host: 198.112.128.214
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win95; I)
  14.  
  15. Slobodan Celenkovic wrote:
  16. > Don't you need virtual keywords in Derived as well?
  17.  
  18. If you mean this:
  19.  
  20. class Animal
  21. {
  22. public:
  23.     virtual void SomeFunc(int value);
  24. };
  25.  
  26. class Dog : public Animal
  27. {
  28.     void SomeFunc(int value);
  29. };
  30.  
  31. no, SomeFunc in the derived class does NOT need the virtual keyword, 
  32. though I would use it to avoid confusion. -j
  33.  
  34.  
  35. -- 
  36. Jesse Liberty. (AT&T New Media Services) jl@staff.ichange.com
  37. Teach Yourself C++ In 21 Days. SAMS, 1994
  38. Teach Yourself MORE C++ In 21 Days. SAMS, 1996
  39. Teach Yourself ANSI C++ In 21 Days. SAMS, 1996
  40. C++: An Introduction To Programming. QUE, 1996
  41.